/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.easyshop.util;

import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author Thiago
 */
public class AjustaImgNoLabel {
    
    public static void ajustaImag(JLabel label, String path ) {        
       try {
            ImageIcon img = new ImageIcon( new ImageIcon(path).getImage().getScaledInstance(label.getWidth(), label.getHeight(), Image.SCALE_DEFAULT) );
        label.setIcon(img);
       } catch (Exception e) {
           JOptionPane.showMessageDialog(null, "Erro ao carregar Imagem", "Atenção", JOptionPane.ERROR_MESSAGE);
           e.printStackTrace();
       }
       
    }
    
}
